package com.xiashitech.agent.instrumentation.internal.classloader.inst;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;

import java.util.List;

import static java.util.Arrays.asList;

@AutoService(InstrumentationModule.class)
public class XSClassLoaderInstrumentationModule extends InstrumentationModule {
  public XSClassLoaderInstrumentationModule() {
    super("xs-internal-class-loader");
  }

  @Override
  public boolean defaultEnabled(ConfigProperties config) {
    // internal instrumentations are always enabled by default
    return true;
  }

  @Override
  public List<TypeInstrumentation> typeInstrumentations() {
    return asList(new XSLoadInjectedClassInstrumentation());
  }

  @Override
  public int order() {
    return 10;
  }

}
